package pkg

import (
	"crypto/md5"
	"encoding/hex"
	"math/rand"
)

func Md5(str string) string {
	hah := md5.New()
	hah.Write([]byte(str))
	return hex.EncodeToString(hah.Sum(nil))
}
func GenSalt(length int) string {
	charset := "dfgdf"
	randStr := make([]byte, length)
	for i := 0; i < length; i++ {
		randStr[i] = charset[rand.Intn(len(charset))]
	}
	return string(randStr)
}
